<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>事件冒泡</title>
    <script>
        function clickDiv(){
           location.href = "32-二级联动菜单.html";
        }
        function clickA(){
            document.getElementById("d").style.display = "none";
            // cancelBubble:设置事件是否应该不向上级传播
            // true:不传播。阻止了事件冒泡
            // false:传播,默认值
            // console.log(event);
            event.cancelBubble = true;
        }

        // function clickA(e){
        //     document.getElementById("d").style.display = "none";
        //     e.cancelBubble = true;
        // }
    </script>
</head>
<body>
<div id="d" style="width: 200px; height: 100px; background: red" onclick="clickDiv()">
    <a href="javascript:;" onclick="clickA()">X</a>
    <!--<a href="javascript:;" onclick="clickA(event)">X</a>-->
</div>
</body>
</html>